import { FC } from "react";
import {
  useNavigate,
  useLocation,
  useSearchParams,
  useParams,
} from "react-router-dom";
export default function withRouer(Wrapper: FC) {
  return function (props: any) {
    const navigate = useNavigate();
    const [query] = useSearchParams();
    const { state } = useLocation();
    const params = useParams();
    return (
      <Wrapper
        navigate={navigate}
        query={query}
        params={params}
        state={state}
        {...props}
      ></Wrapper>
    );
  };
}
